<?php 
require_once(dirname(__FILE__)."/../../libs/login/login.php");
require_once(dirname(__FILE__)."/../../libs/string/libstr.php");
require_once(dirname(__FILE__)."/../../admin/libs/config_class.php");
$lg=new login();
$lg->checklogin("admin_member");//检验是否登录
$mc=new libstr();
$cf=new config();

 

$type=$_GET["type"]?$_GET["type"]:"";
$mark=$cf->getmarks($type);//获取列表
$xu=count($mark)+1;

//修改标记
if($mc->Ismp($_POST["edit"])!=""){
	$id=$mc->request("id",0);
	$classname=$mc->request("classname","");
	$classvalue=$mc->request("classvalue","");
	$classorder=$mc->request("classorder",0);
	$cf->mark_edit($id,$classname,$classvalue,$classorder);
	$mc->msg("","mark.php?type=".$type);
}
//删除标记
if($mc->Ismp($_GET["del"]!="")){
	$cf->mark_del($_GET["del"]);
	$mc->msg("","mark.php?type=".$type);
}

//添加标记
if($mc->Ismp($_POST["add"])!=""){
	$classname=$mc->request("classname","");
	$classvalue=$mc->request("classvalue","");
	$classorder=$mc->request("classorder",0);
	if($mc->Ismp($classname)==""){
		$mc->msg("标签名称不能为空！");
		}
		if($mc->Ismp($classvalue)==""){
		$mc->msg("参数不能为空！");
		}
	$cf->mark_add($classname,$classvalue,$classorder,$type);
	$mc->msg("","mark.php?type=".$type);
	
}
$path="文章属性管理";
//print_r($mark);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
</head>
<body style="background:#fff"> 

<div class="content">
    <div class="right">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="100%" height="24" class="top_head">&nbsp;</td>
      </tr>
      <tr>
        <td valign="top">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="1%" align="right"  height="45">&nbsp;</td>
                <td width="99%" >
                 <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="55%" style="padding-left:20px;padding-top:10px;"><img src="../images/head.gif" width="13" height="11"><b><?php echo $path;?></b></td>
                    <td width="45%" align="right">&nbsp;</td>
                  </tr>
                </table>
                </td>
              </tr>
            </table>
        </td>
      </tr>
      <tr>
          <td valign="middle" align="center" >
            	<table width="92%"   border="1px" bordercolor="#ccc" cellspacing="0px" style="border-collapse:collapse">
                  <thead align="center" bgcolor="#EEEEEE">
                    <tr>
                	<th height="30"  width="25%" align="center">属性名称</th>
                	 <th width="25%" colspan="-4" align="center"><strong>参数名称</strong></th>
                    <th width="25%" colspan="-4" align="center"><strong>排序</strong></th>
                    <th width="25%" colspan="-3" align="center">编辑</th>
                </tr>
              </thead>
              <tbody>
              <?php foreach ($mark as $rs){?>
              <form name="form1" method="post" action="">
              	 <tr align="center" bgcolor="#FFFFFF"> 
              	 <input name="id" type="hidden" id="id" value="<?php echo $rs['ID']; ?>">
                	<td  height="28" align="center"><input name="classname" style="border:1px solid #ccc; width:60px;height:20px; text-align:center" value="<?php echo $rs["classname"];?>"></td>
                	<td  height="28" align="center"><input name="classvalue" style="border:1px solid #ccc; width:60px;height:20px; text-align:center " value="<?php echo $rs["classvalue"];?>"></td>
                    <td height="28" colspan="-4" align="center"><input name="classorder" style="border:1px solid #ccc; width:20px; text-align:center" value="<?php echo $rs["classorder"];?>"></td>
                    <td height="28" colspan="-3" align="center">
                    <bdo><input type="submit" name="edit" id="button2" value="修改"/></bdo>
                      <bdo><input type="button" name="button3" id="button3" value="删除" onclick="location.href='?del=<?php echo $rs['ID']; ?>'"/>
                    </bdo></td>
                </tr>
                </form>
         <?php }?>
                
              </tbody>
            </table>
        </td>
      </tr>
      
      <tr>
          <td valign="middle" align="center" >
            	<table width="92%"   border="1px" bordercolor="#ccc" cellspacing="0px" style="border-collapse:collapse">
                  <thead align="center" bgcolor="#EEEEEE">
                    <tr>
                	<th height="30" width="25%" align="center" colspan="4">添加属性</th>
                	
                </tr>
              </thead>
              <tbody>
              
              <form name="form2" method="post" action="">
              	 <tr align="center" bgcolor="#FFFFFF"> 
                	<td  height="28" align="center">名称：<input name="classname" style="border:1px solid #ccc; width:60px;height:20px;" value=""></td>
                	<td  height="28" align="center">参数：<input name="classvalue" style="border:1px solid #ccc; width:60px;height:20px " value=""></td>
                    <td height="28" colspan="-4" align="center">排序：<input name="classorder" style="border:1px solid #ccc; width:20px; text-align:center" value="<?php echo $xu;?>"></td>
                    <td height="28" colspan="-3" align="center">
                    <bdo><input type="submit" name="add" id="button2" value="添加"/></bdo>
             </td>
                </tr>
                </form>
                
              </tbody>
        </table>
        </td>
      </tr>
    </table>
    
    </div>
</div>
</body>
</html>